    <?php

header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Methods:POST,GET,PUT,DELETE');
header('Access-Control-Allow-Headers:x-requested-with,Content-Type,X-CSRF-Token');

    
    
      $username = $_POST['username'];
      $password = $_POST['password'];
    
      $mysqli = new Mysqli("localhost","root","root","yiguo");
     if($mysqli->connect_errno){
         die();
     }
     $sql = "SELECT username,password FROM t_users where username = '{$username}'";
     $result = $mysqli->query($sql);

     if($result->num_rows){

        /*存在用户名*/
        $row = $result->fetch_assoc();

        // print_r($row);
        $pwd = $row["password"];
        if($password == $pwd){
            echo "true";
        }else{
            echo '密码错误';
        }
    }else{
        echo "用户名不存在";
    }

    ?>